package com.study.a06Test1;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) throws IOException {

        //创建socket对象
        Socket socket= new Socket("127.0.0.1",9000);

        Scanner sc=new Scanner(System.in);
        OutputStream os= socket.getOutputStream();
        while (true) {
            System.out.println("请输入要发送的消息：");
            String msg=sc.nextLine();



            if(msg.equals("exit")){
                break;
            }
            os.write(msg.getBytes());
        }

        socket.close();

    }
}
